package com.example.jeong.yuejian10.Activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;

import com.example.jeong.yuejian10.R;
import com.squareup.picasso.Picasso;

import static com.example.jeong.yuejian10.constant.Constant.CLUB_COURSE_PHOTO_URL;

//俱乐部详情内的精选课程的详情页
public class ClubCourseDetailActivity extends Activity {
    private ImageView left;
    private ImageView collect;
    private ImageView picture;
    private TextView name,cname,ccname;
    private TextView intro;
    private RatingBar ratingBar;


    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_club_course_detail);
        initView();
        initEvents();
        getCoursedetailData();
    }

    private void initView() {

        collect = (ImageView) findViewById(R.id.collect);
        left = (ImageView) findViewById(R.id.left);
         name = (TextView) findViewById(R.id.name);
       cname = (TextView) findViewById(R.id.cname);
        ccname = (TextView) findViewById(R.id.ccname);
        intro = (TextView) findViewById(R.id.intro);
        ratingBar = (RatingBar) findViewById(R.id.ratingBar);
        picture=(ImageView) findViewById(R.id.picture) ;

    }
    public void initEvents(){
        //返回上一页
        left.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    private void getCoursedetailData() {
        Bundle bundle = this.getIntent().getExtras();
        int cc_id = bundle.getInt("cc_id");
        // Log.d("id","t_id");
        String name1 = bundle.getString("cc_name");
        String c_name = bundle.getString("c_name");
        String cc_name = bundle.getString("cc_name");
      String cpic = CLUB_COURSE_PHOTO_URL+bundle.getString("cc_pic");
        String info = bundle.getString("cc_info");
        int level=bundle.getInt("cc_level");
//System.out.print("taddress");
        name.setText(name1);
        cname.setText(c_name);
        ccname.setText(cc_name);
        intro.setText(info);
        ratingBar.setRating(level);
       Picasso.with(this).load(cpic).into(picture);
    }



}